package hu.tortavar2.client.view.product;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.HeadingElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;

public class NewsItemImpl extends Composite {

	private static NewsItemImplUiBinder uiBinder = GWT
			.create(NewsItemImplUiBinder.class);

	interface NewsItemImplUiBinder extends UiBinder<Widget, NewsItemImpl> {
	}

	public NewsItemImpl() {
		initWidget(uiBinder.createAndBindUi(this));
		setFields();
	}

	@UiField HTMLPanel grid_news;
	@UiField HTMLPanel news_image_box;
	@UiField HTMLPanel news_text_box;
	@UiField HTMLPanel news_body;
	
	@UiField Image news_image;
	@UiField HeadingElement news_header;

	
	private void setFields() {
		grid_news.getElement().setClassName("grid_news");
		news_image_box.getElement().setClassName("news-image-box");
		news_text_box.getElement().setClassName("news-text-box");
		news_image.getElement().setClassName("prod-image");
	}
	
	public void setImageUrl(String url) {
		news_image.setUrl(url);
	}
	
	public void setNewsHeader(String text) {
		news_header.setInnerText(text);
	}
	
	public void setNewsText(String text) {
		news_body.getElement().setInnerText(text);
	}
}
